package com.panshi.modules.common.img;

import com.panshi.AnswerApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author :jiege
 * @description :
 * @create :2020-08-22 15:11:00
 */
@Controller
public class Myimg {
    @Autowired
    private AnswerApi answerApi;

    @RequestMapping(value = "/uploadimgAPP", method = RequestMethod.POST)
    @ResponseBody
    public String upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
        String s = answerApi.uploadImg(file);
        System.out.println(s);
        return s;
    }

    @RequestMapping(value = "/img", method = RequestMethod.GET)
    public String uploadimg() {
        return "/img/myimg";
    }
}